import asyncio
import time


async def make_burger(order_num):
    print(f"Preparing burger #{order_num}")
    await asyncio.sleep(5)
    print(f"burger made #{order_num}")


async def main():
    order_queue = []
    for i in range(5):
        order_queue.append(make_burger(i))
    await asyncio.gather(*order_queue)


if __name__ == '__main__':
    s = time.perf_counter()
    asyncio.run(main())
    elapsed = time.perf_counter() - s
    print(f"Finished in {elapsed:.2f} seconds.")

"""
使用asyncio提供的函数，例如run和gather，以及关键字async和await，我们创建出可以并发制作汉堡的协程。

"""